﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ECS.Demos.Tetris.Systems;
using EntityComponentSystem.Framework;
using ECS.Demos.Tetris.Components;
using EntityComponentSystem.Framework.Math;
using EntityComponentSystem.Framework.Systems;

namespace ECS.Demos.Tetris.Behavoirs
{

    public class FallingBlockBehavior : Behavior<IntervalBehaviorSystem>
    {
        public FallingBlockBehavior() : base("interval", "fallingblock") { }

        protected override Action GetEntityBehavior(IntervalBehaviorSystem system, GameEngine ge, int entity)
        {
            var position = ge.GetComponent(entity, "position");
            //var blockframe = ge.GetEntityByTag("blockframe");
            //var blockframePosition = ge.GetComponent(blockframe, "position");
            //var blockframeSize = ge.GetComponent(blockframe, "size");
            return new Action(() =>
            {
                //int x1 = blockframePosition["x"];
                //int x2 = x1 + blockframeSize["width"];
                //int y1 = blockframePosition["y"];
                //int y2 = y1 + blockframeSize["height"];


                position["y"] += 1f;
            });
        }
    }
}
